--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Node / ReticulumProjects / MeshChatX.git / files / docs / agents / skills / landlock-sqlite / SKILL.md
docs/agents/skills/landlock-sqlite/SKILL.md dev (b5f9665d) Text, 4.03 KB
Skill: landlock-sqlite
Landlock / Windows AppContainer + SQLite conversation-load failures (temp_store, slim queries, memory pressure). Also covers subprocess and user-local CLI breakage under Linux Landlock.
MeshChatX FS sandbox + SQLite
Symptoms
• T383838/api/v1/lxmf/conversations or T383838/api/v1/notifications return 500/503
• Logs show T383838sqlite3.OperationalError: unable to open database file
• Happens after Landlock or Windows AppContainer enables, often with large message T383838fields / base64 blobs
Root causes (priority order)
1. Worker-thread connections missing T383838PRAGMA temp_store=MEMORY (T383838DatabaseProvider._configure_connection)
2. Conversation SELECT pulling full T383838content / T383838fields
3. Memory-pressure switching to T383838temp_store=FILE under a filesystem sandbox
4. Identity context not ready (should be 503, not 500)
Required behavior
• Default: T383838temp_store=MEMORY on every new connection
• FS sandbox active (T383838landlock_active or T383838appcontainer_active / T383838fs_sandbox_active) + memory pressure: shrink cache/mmap, keep MEMORY temp
• Non-sandbox memory pressure may use FILE temp + storage-local T383838sqlite-tmp TMPDIR
• List queries: T383838substr(content, 1, 240) and SQL T383838instr flags for attachments
• API: map OperationalError / unable-to-open / locked to 503 with retryable message
Subprocess and user-local tools (Linux Landlock)
Symptoms
• Translator shows Argos as available but no languages after Refresh, or translation fails with T383838Permission denied
• T383838argospm list or T383838argos-translate works in a normal shell but not inside MeshChatX
• PATH tools in T383838~/.local/bin fail while T383838/usr/bin tools work
Root causes
1. Landlock read roots did not include pipx or user-local install paths (T383838~/.local/bin, T383838~/.local/share/pipx)
2. Argos Stanza needs write under T383838~/.local/share/argos-translate (not read-only)
3. T383838TranslatorHandler used Python T383838argostranslate with zero packages and did not fall back to T383838argospm list
4. Symlink wrappers in T383838~/.local/bin that point outside allowed trees (not fixable by widening T383838~/.local/bin alone)
Required behavior
• T383838_collect_read_roots() includes user-local CLI roots when present (T383838landlock_sandbox._collect_user_local_cli_roots)
• T383838_collect_rw_roots() includes T383838~/.local/share/argos-translate when present
• New external-tool integrations: add roots and a probe in T383838tests/backend/test_landlock_integration_surfaces.py
Windows counterpart
• Module: T383838meshchatx/src/backend/appcontainer_sandbox.py
• Launcher: T383838meshchatx/src/backend/appcontainer_launcher.py via T383838--meshchatx-run-module
• Electron win32 spawn uses the launcher only when T383838MESHCHAT_APPCONTAINER=1
Verification
T282828
uv run pytest tests/backend/test_sqlite_landlock_temp_store.py tests/backend/test_sqlite_memory_pressure.py tests/backend/test_landlock_sandbox.py tests/backend/test_landlock_integration_surfaces.py tests/backend/test_appcontainer_sandbox.py tests/backend/test_self_check.py -q
pnpm Tffa657exec vitest run tests/frontend/i18n.test.js
bash scripts/ci/github-verify-frozen-sandbox.sh build/exe
For live stress, run Landlock in a subprocess (sandbox applies once per process). Expect FILE temp complex queries to fail under Landlock. MEMORY must pass. On Windows, confirm T383838appcontainer_active via T383838/api/v1/server/security. Headless self-check includes T383838FS Sandbox Modules and requires AppContainer status fields on T383838/api/v1/server/security.
Key files
• T383838meshchatx/src/backend/database/provider.py
• T383838meshchatx/src/backend/database/__init__.py
• T383838meshchatx/src/backend/memory_pressure.py
• T383838meshchatx/src/backend/landlock_sandbox.py
• T383838meshchatx/src/backend/appcontainer_sandbox.py
• T383838meshchatx/src/backend/appcontainer_launcher.py
• T383838meshchatx/src/backend/seccomp_sandbox.py (syscall denylist after Landlock)
• T383838meshchatx/src/backend/translator_handler.py (Argos CLI and lib language listing)
• T383838tests/backend/landlock_integration_support.py
• T383838tests/backend/test_landlock_integration_surfaces.py
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────